import java.util.*;
import java.io.IOException;
import javax.servlet.*;
import javax.servlet.http.*;
import java.sql.*;
import com.DefectTracking.*;

public class LandingPageServlet extends HttpServlet {
    public LandingPageServlet() {
        super();
    }
    public void init(ServletConfig servletConfig) throws ServletException {
        super.init(servletConfig);
    }
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        DefectManager dm = new DefectManager();
		List<Defect> defectTable = new ArrayList<Defect>();
        defectTable = dm.getAllOpenDefects();

        RequestDispatcher dispatcher = getServletConfig().getServletContext().getRequestDispatcher("/main.jsp");
        request.setAttribute("defect_list" , defectTable);


			        //Forward to JSP
        dispatcher.forward(request,response);
		response.setContentType("text/html");
	}
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
		doPost(request, response);
    }
}
